/*
  @author: 13813
  @date: 2024/11/11 14:22
*/
public class ArrayDemo01 {
    public static void main(String[] args) {
        /*
            定义数组
            1.明确类型
            2.数组长度
         */
        int[] arr = new int[3];

        //存(下标，从0开始)
        arr[0] = 10;
        arr[1] = 20;
        arr[2] = 30;

        //取
//        System.out.println(arr[0]);
//        System.out.println(arr[1]);
//        System.out.println(arr[2]);

        //遍历
        for (int i = 0; i < 3; i++) {
            System.out.println(arr[i]);
        }
        /*
           1.i=0, 0<3, System.out.println(arr[0]); i=1
           2.     1<3, System.out.println(arr[1]); i=2
           3.     2<3, System.out.println(arr[2]); i=3
           4.     3<3
         */
    }
}
